<div class="slide code_highlight_slide">
	<span class="section">Tip #3: Move business logic into models and share them.</span>
	<h1>Sharing model with providers</h1>
	<pre class="highlightjs">
		<code>
		var NotesModel = EventDispatcher.extend({
			[...]
		});


		var NotesModelProvider = Class.extend({

			instance: new NotesModel(),

			$get:['$location','$route','NotesService',function($location,$route,NotesService){
				//Configuring NotesModel before sending out the instance
				this.instance._routes = $route;
				this.instance._location = $location;
				this.instance._notesService = NotesService;
				return this.instance;
			}]
		})
	//Registering the module and its provider for Angular Usage
	angular.module('notes.NotesModel',[])
		.provider('NotesModel',NotesModelProvider);



	//Inject model anywhere after that
	var NotesController = BaseController.extend({

		[...]

		init:function($scope,NotesModel,Notifications,$route){
			this._super($scope)
			this._notifications = Notifications;
			
			//NotesModel is now available to for usage.
			this._notesModel = NotesModel;
			this._notesModel.loadSlides();
		}

		[...]
	})


	NotesController.$inject = ['$scope','NotesModel','Notifications','$route'];



</code>
	</pre>
	<span class="credits">It's also possible to write providers that returns a new instance of the model each time instead of sharing it.</span>
</div> 